package com.bigdata.service.controller.app;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.date.DateUtil;
import com.bigdata.common.annotation.Log;
import com.bigdata.common.annotation.RepeatSubmit;
import com.bigdata.common.core.controller.BaseController;
import com.bigdata.common.core.domain.PageQuery;
import com.bigdata.common.core.domain.R;
import com.bigdata.common.core.page.TableDataInfo;
import com.bigdata.common.core.validate.AddGroup;
import com.bigdata.common.core.validate.EditGroup;
import com.bigdata.common.enums.BusinessType;
import com.bigdata.common.utils.poi.ExcelUtil;
import com.bigdata.service.domain.bo.HistoryRecordsBo;
import com.bigdata.service.domain.vo.HistoryRecordsVo;
import com.bigdata.service.service.IHistoryRecordsService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * 地图预警
 *
 * @author ruoyi
 * @date 2025-08-19
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/app/service/records")
public class AppHistoryRecordsController extends BaseController {

    private final IHistoryRecordsService iHistoryRecordsService;

    /**
     * 查询地图预警列表
     */
    @SaIgnore
    @PostMapping("/list")
    public TableDataInfo<HistoryRecordsVo> list(@RequestBody HistoryRecordsBo bo) {
        PageQuery pageQuery = new PageQuery();
        pageQuery.setPageNum(bo.getPageNum());
        pageQuery.setPageSize(bo.getPageSize());
        return iHistoryRecordsService.queryPageList(bo, pageQuery);
    }


    /**
     * 查询地图预警列表
     */
    @SaIgnore
    @PostMapping("/newList")
    public TableDataInfo<HistoryRecordsVo> newList() {
        HistoryRecordsBo bo = new HistoryRecordsBo();
        PageQuery pageQuery = new PageQuery();
        pageQuery.setPageNum(1);
        pageQuery.setPageSize(100);
        bo.setBeginTime(DateUtil.date());
        bo.setEndTime(DateUtil.offsetDay(new Date(), -7));
        return iHistoryRecordsService.queryPageList(bo, pageQuery);
    }

}
